package com.spark.lola.logistics.mapper;

import com.spark.lola.logistics.entity.OrderProcess;
import com.spark.lola.support.mybatis.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @author: Zhi-peng wang
 * @date: 2020/04/26 16:10
 * 货运单流程记录mapper
 **/
@Mapper
public interface LogisticsOrderProcessMapper extends BaseMapper<OrderProcess> {

    @Select("select * from logistics_order_process where order_id=#{orderInfoId}")
    List<OrderProcess> findByOrderId(long orderInfoId);

    @Delete("delete from logistics_order_process where order_id=#{orderInfoId}")
    int deleteByOrderId(long orderInfoId);

    @Select("select * from logistics_order_process where order_id=#{orderInfoId} and action_code=#{actionCode} and flag=#{flag}")
    List<OrderProcess> findNewest(long orderInfoId, int actionCode, int flag);

    @Select("select create_time from logistics_order_process where order_id=#{orderInfoId} and action_code=#{actionCode} and flag=#{flag}")
    Date findCreateTimeNewest(long orderInfoId, int actionCode, int flag);

}
